package main

import (
	"encoding/base64"
	"fmt"
	"log"
)

func main() {
	str := "www.5lmh.com"
	fmt.Printf("string : %v\n", str)
	input := []byte(str)
	fmt.Printf("[]byte : %v\n", input)
	// 演示base64编码
	encodeString := base64.StdEncoding.EncodeToString(input)
	fmt.Printf("encode base64 : %v\n", encodeString)
	// 对上面的编码结果进行base64解码
	decodeBytes, err := base64.StdEncoding.DecodeString(encodeString)
	if err != nil {
		log.Fatalln(err)
	}
	fmt.Printf("decode base64 : %v\n", string(decodeBytes))
	fmt.Println()
	// 如果要用在url中，需要使用URLEncoding
	urlencode := base64.URLEncoding.EncodeToString([]byte(input))
	fmt.Printf("urlencode : %v\n", urlencode)
	//URLEncoding
	urldecode, err := base64.URLEncoding.DecodeString("eJzsnVlvo0mynv-KoOtqdexLAQYM2DDsKwPGwbmwPTByiexWlbaiVFsP-r8bUs3MaarZdVgzlFRzwCtBJEV9zHz4fpFvREb--bTdnP9rbW7Pr69OX59-wNNXpz_VVW3aXc3T16cEhD-A_EDyL8ivMV8TnSVFICLE_z59ddpubm5PX__5dF28_3T_86pd1unrL78-PPs_7t-m3dz88PESlDZAby_e3Xy201ens27H6evT_3bx_tPJ-e1JO7m7vr44ufu53Z2093fXl-3ufLSLi88ndXX7flO3X566-7lObu_aXZ1cr5N2Mi7e397V5uSy3Y2f6_bk4_1rzm9Pbm9qnK_zmifnVycfvnzAk3F9dbe5vjh9dXr_Du9vT1-fnr46PR8Pn_3nu7ub29c__rhpH89-Or_7-X1_f1ub-z-pq7uzcX354_2HGvPhx4-X7f7f_jivx-2P_2-dX9Ttjx-rfagf7p89u7n66fTV6fi5be5uT1__nz-ffqjNXwfiww83tCG5-SBxuXmrl6evHg3az9cPv_31er7817Pz6_vLvn6_GXX_ln97-sulPr6-0z-9Ov3wt2nFszyDv4z45vzm7sujLzLwb-vzx-vNfPgIP53fXd_c3l_qZTu_umvnV7X5Mlx_GZDbu1rt6mZzPdvV6avTumznF397-D8_jPfZx-vN29vTX__0hPP4-69I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